<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/layout.css" />
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/module_public.css" />
  <script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
  <script type="text/javascript" src="__PUBLIC__/Js/schedule.js"></script>
</head>
<body>
  <div class="module_public">
     <div class="module_public_content">
        <h1> >> 本月日常安排 <a href="__ACTION__">【刷新】</a></font>&nbsp;<font color=red>(提示:今天已为您高亮显示)</font></h1>
     </div>
  <div class="module_public_main">
     <table>
       <?php if($days == '30'): $__FOR_START_1208__=1;$__FOR_END_1208__=31;for($i=$__FOR_START_1208__;$i < $__FOR_END_1208__;$i+=1){ if($now_day == $i): ?><tr>
           <td width="8%" align="right" bgcolor="#cccccc"><?php echo ($month); ?>月<?php echo ($i); ?>号:</td>
           <td class="input_text" title="<?php echo ($i); ?>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
           </tr>
           <?php else: ?>
           <tr>
           <td width="8%" align="right"><?php echo ($month); ?>月<?php echo ($i); ?>号:</td>
           <td class="input_text" title="<?php echo ($i); ?>">&nbsp;<a href="#" class="s_look">[查看当天安排]</a></td>
           </tr><?php endif; } ?>
       <?php elseif($days == '28'): ?>
       <?php $__FOR_START_23888__=1;$__FOR_END_23888__=29;for($i=$__FOR_START_23888__;$i < $__FOR_END_23888__;$i+=1){ if($now_day == $i): ?><tr>
         <td width="8%" align="right" bgcolor="#cccccc"><?php echo ($month); ?>月<?php echo ($i); ?>号:</td>
         <td class="input_text" title="<?php echo ($i); ?>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
         </tr>
         <?php else: ?>
         <tr>
         <td width="8%" align="right"><?php echo ($month); ?>月<?php echo ($i); ?>号:</td>
         <td class="input_text" title="<?php echo ($i); ?>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
         </tr><?php endif; } ?>
       <?php else: ?>
       <?php $__FOR_START_31347__=1;$__FOR_END_31347__=32;for($i=$__FOR_START_31347__;$i < $__FOR_END_31347__;$i+=1){ if($now_day == $i): ?><tr>
          <td width="8%" align="right" bgcolor="#cccccc"><?php echo ($month); ?>月<?php echo ($i); ?>号:</td>
          <td class="input_text" title="<?php echo ($i); ?>" name="<?php echo ($month); ?>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
          </tr>
          <?php else: ?>
          <tr>
          <td width="8%" align="right"><?php echo ($month); ?>月<?php echo ($i); ?>号:</td>
          <td class="input_text" title="<?php echo ($i); ?>" name="<?php echo ($month); ?>">&nbsp;<a href="#" class="s_look" >[查看当天安排]</a></td>
          </tr><?php endif; } endif; ?>
     </table>
  </div>
  <script type="text/javascript">
    $(function(){
	//获取到双击的相应表格，并创建INPUT输入框
	$(".input_text").dblclick(function(){
		var days = $(this).attr("title");
		var months = $(this).attr("name");
		$(this).html("<input type='text' id='text_v' value='请输入日常安排...' style='width:100%;height:20px;'/>");	
			
		  //焦点到INPUT输入框时
		  $("#text_v").focus(function(){
			 var val = this.value;
		     if(this.value == "请输入日常安排..."){
				this.value = ""; 
			 }else{
				this.value = val;  
			 }
	      });
		  
		  $("#text_v").blur(function(){
			 var value = this.value;
			 
			 $.get("__URL__/save_input",{
				 v : value, 
				 day : days,
				 month : months
			 },function(data){
				 if(data=="1"){
					alert("日程安排成功"); 
					location.reload();
				 }else{
					alert("日程安排失败,请重新尝试"); 
				 }
			 });
			 
			 $(this).remove();
		  });	
	})
	
	//查看日程安排
	$(".s_look").click(function(){
	   $this_element = $(this);
	   $day = $(this).parent().attr("title");
	   $month = $(this).parent().attr("name");
	   $.get("__URL__/look_schedule",{
		   day : $day, 
		   month : $month
	   },function(data){
		   $this_element.parent().html(data); 
	   });
	   return false;
	});
});  
  </script>
  </div>
</body>
</html>